package com.yboot.starter.common.core.exception;

import cn.hutool.extra.pinyin.PinyinUtil;
import cn.hutool.extra.pinyin.engine.pinyin4j.Pinyin4jEngine;

/**
 * 自定义业务异常
 *
 * @author Charles7c
 * @since 1.0.0
 */
public class BusinessException extends RuntimeException implements BaseException{

    private static final long serialVersionUID = 1L;
    private ErrorCodeSpecification errorCode;

    public BusinessException() {
    }

    public BusinessException(String message) {
        super(message);
        this.errorCode = ErrorCodeEnum.COMMON_ERROR;
    }

    public BusinessException(ErrorCodeSpecification errorCode) {
        super(errorCode.getMessage());
        this.errorCode = errorCode;
    }

    public ErrorCodeSpecification getErrorCode() {
        return this.errorCode;
    }

    public String getCode() {
        return this.errorCode.getCode();
    }

}